package model;

public class Cell {

	public Ant ant;
	public Resource resource;
	public int pheromone;
	
	public boolean isAttractionPoint;
	//public boolean attractionOrientation;
	
	public Cell(){
		ant = null;
		resource = null;
		pheromone = 0;
	}

	public Ant getAnt() {
		return ant;
	}
	
	public void setAnt(Ant ant) {
		this.ant = ant;
	}
	
	public void removeAnt() {
		ant = null;
	}
	
	public boolean containsAnt(){
		if (ant == null){
			return false;
		} else {
			return true;
		}
	}

	public Resource getResource() {
		return resource;
	}
	
	public void setResource(Resource resource) {
		this.resource = resource;
	}
	
	public void removeResource() {
		resource = null;
	}
	
	public boolean containsResource(){
		if (resource == null){
			return false;
		} else {
			return true;
		}
	}
	
	public boolean containsResourceR1(){
		if (resource == null){
			return false;
		} else {
			if (this.resource.type.equalsIgnoreCase("r1")){
				return true;
			} else {
				return false;
			}
		}
	}
	
	public boolean containsResourceR2(){
		if (resource == null){
			return false;
		} else {
			if (this.resource.type.equalsIgnoreCase("r2")){
				return true;
			} else {
				return false;
			}
		}
	}
	
	public boolean containsResourceR3(){
		if (resource == null){
			return false;
		} else {
			if (this.resource.type.equalsIgnoreCase("r3")){
				return true;
			} else {
				return false;
			}
		}
	}

	public int getPheromone() {
		return pheromone;
	}

	public void incPheromone() {
		if (this.pheromone<100){
			this.pheromone ++;
		}
	}
	
	public void decPheromone() {
		if (this.pheromone != 0){
			this.pheromone --;
		}
	}
	
	public String toString(){
		String s = "";
		if (ant != null){
			s += "Ant : " + ant.toString()+"\n";
		} else {
			s += "No ant \n";
		}
		if (resource != null){
			s += "Resource : " + resource.toString()+"\n";
		} else {
			s += "No resource \n";
		}
		s += "Pheromone : " + pheromone;
		return s;
	}

	public boolean isAttractionPoint() {
		return isAttractionPoint;
	}

	public void setAttractionPoint(boolean isAttractionPoint) {
		this.isAttractionPoint = isAttractionPoint;
	}

	void removePheromone() {
		this.pheromone = 0;
	}
		
}
